
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<!doctype html>
<html>
<head>
<title>欢迎来到家在曼城</title>
<link href="<c:url value="/resources/front/css/base.css"/>" rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/front/css/style.css"/>" rel="stylesheet" type="text/css">

<style>

</style>

</head>
<body>
<div class="content">
    <div class="w1210 auto bg2d140f rel">
        <div class="hear">
            <div class="UserDiv tr f16">
            <c:choose>
				<c:when test="${sessionScope.user == null}">
				<a href="<c:url value="/front/register" />" class="wh">${sessionScope.user.username}注册</a>
				<a class="dib vm UserHP mr10"><img src="<c:url value="/resources/front/images/tu1.jpg"/>" width="35" height="35"></a>
				</c:when>
				<c:otherwise>
				 <a href="#" class="wh">${sessionScope.user.username}</a>
				 <a href="#" class="dib vm UserHP mr10"><img src="<c:url value="/resources/front/images/tu1.jpg"/>" width="35" height="35"></a> 
				</c:otherwise>
			</c:choose>
</div>
        </div>
        <div class="nav rel"> <i class="navBg1 db abs"></i> <i class="navBg2 db abs"></i><a href="#" class="Logo abs"></a>
            <div class="navMn rel">
                <ul class="navUl dt pct100 f0 nowrap">
                    <li class="navList dib vm"><a href="#" class='active'><i class="navT0"></i></a></li>
                    <li class="navList dib vm"><a href="#"><i class="navT1"></i></a></li>
                    <li class="navList dib vm"><a href="#"><i class="navT2"></i></a></li>
                    <li class="navList dib vm"><a href="#"><i class="navT3"></i></a></li>
                    <li class="navList dib vm"><a href="#"><i class="navT4"></i></a></li>
                    <li class="search dib vm">
                        <div class="dt f0 pct100"> <i class="navT5 dib vm"></i>
                            <input type="text" class="dib vm searchInput">
                            <a href="javascript:void(0)" class="dib vm searchBtn ml10"></a> </div>
                    </li>
                </ul>
            </div>
        </div>
        <div class="dt pct100">
            <div class="recommend l">
                <div class="dt f0 pct100">
                    <div class="dib vt">
                    <p class="Title"></p>
                    <dl>
                        <dt class="f28 b pt5 pb5">－论《伊利亚特》的艺术成就</dt>
                        <dd class="f20 mt5 ba">标准的英式早餐主要包括以下几种食品：
                            面包、煎肉肠、培根、香肠、蘑菇、番茄、
                            炖豆子、凉牛奶、麦片、酸奶以及少量水
                            果，有时还有炸薯条，当然咖啡或茶也是
                            必不可少的。虽然味道不那么合乎中国人
                            的口味，但是从营养的角度讲，还是较为
                            全面均衡的。</dd>
                    </dl>
                    <div class="tr mt20"> <a href="#" class="btn0 dib vt f18 wh mr10">查看更多</a> </div>
                    </div>
                    <div class="dib vt">
                    <p class="Title"></p>
                    <dl>
                        <dt class="f28 b pt5 pb5">－论《伊利亚特》的艺术成就</dt>
                        <dd class="f20 mt5 ba">标准的英式早餐主要包括以下几种食品：
                            面包、煎肉肠、培根、香肠、蘑菇、番茄、
                            炖豆子、凉牛奶、麦片、酸奶以及少量水
                            果，有时还有炸薯条，当然咖啡或茶也是
                            必不可少的。虽然味道不那么合乎中国人
                            的口味，但是从营养的角度讲，还是较为
                            全面均衡的。</dd>
                    </dl>
                    <div class="tr mt20"> <a href="#" class="btn0 dib vt f18 wh mr10">查看更多</a> </div>
                    </div>
                    <div class="dib vt">
                    <p class="Title"></p>
                    <dl>
                        <dt class="f28 b pt5 pb5">－论《伊利亚特》的艺术成就</dt>
                        <dd class="f20 mt5 ba">标准的英式早餐主要包括以下几种食品：
                            面包、煎肉肠、培根、香肠、蘑菇、番茄、
                            炖豆子、凉牛奶、麦片、酸奶以及少量水
                            果，有时还有炸薯条，当然咖啡或茶也是
                            必不可少的。虽然味道不那么合乎中国人
                            的口味，但是从营养的角度讲，还是较为
                            全面均衡的。</dd>
                    </dl>
                    <div class="tr mt20"> <a href="#" class="btn0 dib vt f18 wh mr10">查看更多</a> </div>
                    </div>
                    <div class="dib vt">
                    <p class="Title"></p>
                    <dl>
                        <dt class="f28 b pt5 pb5">－论《伊利亚特》的艺术成就</dt>
                        <dd class="f20 mt5 ba">标准的英式早餐主要包括以下几种食品：
                            面包、煎肉肠、培根、香肠、蘑菇、番茄、
                            炖豆子、凉牛奶、麦片、酸奶以及少量水
                            果，有时还有炸薯条，当然咖啡或茶也是
                            必不可少的。虽然味道不那么合乎中国人
                            的口味，但是从营养的角度讲，还是较为
                            全面均衡的。</dd>
                    </dl>
                    <div class="tr mt20"> <a href="#" class="btn0 dib vt f18 wh mr10">查看更多</a> </div>
                    </div>
                </div>
            </div>
            <div class="banner r">
                <div class="slide" id="slide"> <a href="javascript:void(0)" class="prev"></a><a href="javascript:void(0)" class="next"></a>
                    <div class="slide-prc">
                        <ul>
                            <li class="list"><img src="https://ununsplash.imgix.net/photo-1417021423914-070979c8eb34?fit=crop&fm=jpg&q=75&w=1050" /></li>
                            <li class="list"><img src="https://ununsplash.imgix.net/photo-1416949929422-a1d9c8fe84af?fit=crop&fm=jpg&q=75&w=1050" /></li>
                            <li class="list"><img src="https://ununsplash.imgix.net/photo-1417021423914-070979c8eb34?fit=crop&fm=jpg&q=75&w=1050" /></li>
                            <li class="list"><img src="https://ununsplash.imgix.net/photo-1416949929422-a1d9c8fe84af?fit=crop&fm=jpg&q=75&w=1050" /></li>
                        </ul>
                    </div>
                    <div class="slide-btn">
                        <div class="dt mr30 r"> <a href="javascript:void(0)" class="dib vm active"></a> <a href="javascript:void(0)" class="dib vm"></a> <a href="javascript:void(0)" class="dib vm"></a> <a href="javascript:void(0)" class="dib vm"></a></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="pct100 dt main">
        	<div class="l sidebar">
        		<c:choose>
				<c:when test="${sessionScope.user == null}">
				<div class="Login rel mt15">
                	<img src="<c:url value="/resources/front/images/bg2.jpg"/>" class="abs LoginBg pct100">
                    <input type="text" id="username" name="username" class="LoginInput UserInput abs f20" placeholder="用户名">
                    <input type="password" id="password" name="password" class="LoginInput PasswInput abs f20"placeholder="密码">
                    <a href="javascript:void(0)" class="SimulationCheckbox abs checked"></a>
                    <a href="javascript:void(0)" id="submitMe" class="submitBtn abs"></a>
                </div>
				</c:when>
				<c:otherwise>
            	
                </c:otherwise>
                </c:choose>
                <div class="ImgDiv mt15">
                <a href="#"><img src="<c:url value="/resources/front/images/tu2.jpg"/>"></a>
                </div>
                <div class="mt15"><img src="<c:url value="/resources/front/images/title1.jpg"/>" class="pct100"></div>
                <div class="bulletin mt15">
                	<p class="tc"><img src="<c:url value="/resources/front/images/title2.jpg"/>"></p>
                    <p class="tr bulletinTop"><a href="#"><img src="<c:url value="/resources/front/images/Icon5.jpg"/>"></a></p>
                    <ul>
                    <li class="bulletinList">
                    <a href="#" class="f16 ml5 mr5"><span class="ell">1.十月剧组即将举行大型话剧类节目</span></a>
                    </li>
                    <li class="bulletinList">
                    <a href="#" class="f16 ml5 mr5"><span class="ell">1.十月剧组即将举行大型话剧类节目</span></a>
                    </li>
                    <li class="bulletinList">
                    <a href="#" class="f16 ml5 mr5"><span class="ell">1.十月剧组即将举行大型话剧类节目</span></a>
                    </li>
                    <li class="bulletinList">
                    <a href="#" class="f16 ml5 mr5"><span class="ell">1.十月剧组即将举行大型话剧类节目</span></a>
                    </li>
                    <li class="bulletinList">
                    <a href="#" class="f16 ml5 mr5"><span class="ell">1.十月剧组即将举行大型话剧类节目</span></a>
                    </li>
                    </ul>
                </div>
                <div class="ImgDiv mt15">
                <a href="#"><img src="<c:url value="/resources/front/images/tu2.jpg"/>"></a>
                </div>
                 <div class="mt15"><img src="<c:url value="/resources/front/images/title3.jpg"/>" class="pct100"></div><div class="bulletin mt15">
                	<p class="tc"><img src="<c:url value="/resources/front/images/title4.jpg"/>"></p>
                    <p class="tr bulletinTop"><a href="#"><img src="<c:url value="/resources/front/images/Icon5.jpg"/>"></a></p>
                    <ul>
                    <c:forEach items="${topics }" var="topic" varStatus="status">
                    <li class="bulletinList">
                    	<a href="#" class="f16 ml5 mr5"><span class="ell">${status.index+1 }. ${topic.subject }</span></a>
                    </li>
                    </c:forEach>
                    
                    </ul>
                </div>
            </div>
            <div class="column r">
            	<div class="mt15 ovh">
                	<ul class="dt f0 columnUl">
                    <li class="columnList dib vt">
                    	<dl>
                        	<dt class="f30 tc">我是吃货</dt>
                            <dd class="Merchant">
                            	<div class="pt20 ml20 mr20 f16">
                            	<c:forEach items="${foodInfos }" var="info" varStatus="status">
                            		<p class="mt10">${info.title }</p>
                            	</c:forEach>
                                </div>
                            </dd>
                            <dd class="MerchantLogo tc"><img src="<c:url value="/resources/front/images/tu3.png"/>" width="122"></dd>
                            <dd class="MerchantRaiders">
                            	<div class="pt20 ml20 mr20 f16">
                            	<c:forEach items="${foodInfos }" var="info" varStatus="status">
                            		<p class="mt10">${info.title }</p>
                            	</c:forEach>
                                </div>
                            </dd>
                        </dl>
                        <a href="#" class="f16 more abs">更多...</a>
                    </li>
                    <li class="columnList dib vt">
                    	<dl>
                        	<dt class="f30 tc">优惠券</dt>
                            <dd class="Merchant">
                            	<div class="pt20 ml20 mr20 f16">
                            	<c:forEach items="${coupons }" var="info" varStatus="status">
                            		<p class="mt10">${info.name }</p>
                            	</c:forEach>
                                </div>
                            </dd>
                            <dd class="MerchantLogo tc"><img src="<c:url value="/resources/front/images/tu3.png"/>" width="122"></dd>
                            <dd class="MerchantRaiders">
                            	<div class="pt20 ml20 mr20 f16">
                                <p class="mt10">那些年说要和我一起吃成包子的男...</p>
                                <p class="mt10">为什么人人都爱说自己是吃货？</p>
                                <p class="mt10">大家说说曼城什么地方最好吃</p>
                                </div>
                            </dd>
                        </dl>
                        <a href="#" class="f16 more abs">更多...</a>
                    </li>
                    <li class="columnList dib vt">
                    	<dl>
                        	<dt class="f30 tc">住在曼城</dt>
                            <dd class="Merchant">
                            	<div class="pt20 ml20 mr20 f16">
                                    <c:forEach items="${rents }" var="info" varStatus="status">
                            			<p class="mt10">${info.title }</p>
                            		</c:forEach>
                                </div>
                            </dd>
                            <dd class="MerchantLogo tc"><img src="<c:url value="/resources/front/images/tu3.png"/>" width="122"></dd>
                            <dd class="MerchantRaiders">
                            	<div class="pt20 ml20 mr20 f16">
                                <p class="mt10">那些年说要和我一起吃成包子的男...</p>
                                <p class="mt10">为什么人人都爱说自己是吃货？</p>
                                <p class="mt10">大家说说曼城什么地方最好吃</p>
                                </div>
                            </dd>
                        </dl>
                        <a href="#" class="f16 more abs">更多...</a>
                    </li>
                    </ul>
                    <ul class="dt f0 mt30 columnUl">
                    <li class="columnList dib vt">
                    	<dl>
                        	<dt class="f30 tc">二手</dt>
                            <dd class="Merchant">
                            	<div class="pt20 ml20 mr20 f16">
                                   <c:forEach items="${secondaries }" var="info" varStatus="status">
                            			<p class="mt10">${info.title }</p>
                            		</c:forEach>
                                </div>
                            </dd>
                            <dd class="MerchantLogo tc"><img src="<c:url value="/resources/front/images/tu3.png"/>" width="122"></dd>
                            <dd class="MerchantRaiders">
                            	<div class="pt20 ml20 mr20 f16">
                                <p class="mt10">那些年说要和我一起吃成包子的男...</p>
                                <p class="mt10">为什么人人都爱说自己是吃货？</p>
                                <p class="mt10">大家说说曼城什么地方最好吃</p>
                                </div>
                            </dd>
                        </dl>
                        <a href="#" class="f16 more abs">更多...</a>
                    </li>
                    <li class="columnList dib vt">
                    	<dl>
                        	<dt class="f30 tc">新生指南</dt>
                            <dd class="Merchant">
                            	<div class="pt20 ml20 mr20 f16">
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                </div>
                            </dd>
                            <dd class="MerchantLogo tc"><img src="<c:url value="/resources/front/images/tu3.png"/>" width="122"></dd>
                            <dd class="MerchantRaiders">
                            	<div class="pt20 ml20 mr20 f16">
                                <p class="mt10">那些年说要和我一起吃成包子的男...</p>
                                <p class="mt10">为什么人人都爱说自己是吃货？</p>
                                <p class="mt10">大家说说曼城什么地方最好吃</p>
                                </div>
                            </dd>
                        </dl>
                        <a href="#" class="f16 more abs">更多...</a>
                    </li>
                    <li class="columnList dib vt">
                    	<dl>
                        	<dt class="f30 tc">超市</dt>
                            <dd class="Merchant">
                            	<div class="pt20 ml20 mr20 f16">
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                    <p class="mt10">法式优雅</p>
                                </div>
                            </dd>
                            <dd class="MerchantLogo tc"><img src="<c:url value="/resources/front/images/tu3.png"/>" width="122"></dd>
                            <dd class="MerchantRaiders">
                            	<div class="pt20 ml20 mr20 f16">
                                <p class="mt10">那些年说要和我一起吃成包子的男...</p>
                                <p class="mt10">为什么人人都爱说自己是吃货？</p>
                                <p class="mt10">大家说说曼城什么地方最好吃</p>
                                </div>
                            </dd>
                        </dl>
                        <a href="#" class="f16 more abs">更多...</a>
                    </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="link rel pb30">
        	<h6 class="f28 wh pt30 pl30">友情链接：</h6>
            <div class="wh pct100 dt f0 pb30 pt30">
            	<div class="dib vm pct33 f26"><a href="#" class="dt pct100"><img src="<c:url value="/resources/front/images/Icon7.png"/>" class="dib vm"><em class="dib vm ml15 f26 n wh">微信公共号</em></a></div>
                <div class="dib vm pct33 f26"><a href="#" class="dt pct100"><img src="<c:url value="/resources/front/images/Icon8.png"/>" class="dib vm"><em class="dib vm ml15 f26 n wh">微信公共号</em></a></div>
                <div class="dib vm pct33 f26"><a href="#" class="dt pct100"><img src="<c:url value="/resources/front/images/Icon9.png"/>" class="dib vm"><em class="dib vm ml15 f26 n wh">微信公共号</em></a></div>
            </div>
            <p class="linkBg"><img src="<c:url value="/resources/front/images/Icon10.png"/>" class="pct100"></p>
        </div>
        <!--用户下拉信息-->
      
        <div class="UserLayer abs">
         <c:choose>
				<c:when test="${sessionScope.user == null}">
				</c:when>
				<c:otherwise>
				<ul>
                <li><a href="#">个人信息</a></li>
                <li><a href="javascript:logout()">退出</a></li>
            </ul>
				</c:otherwise>
		 </c:choose>
            
        </div>
    </div>
</div>

</body>
</html>
<script src="<c:url value="/resources/jquery/1.9.1/jquery.min.js" />"></script>
<script src="<c:url value="/resources/bootstrap/2.3.2/js/bootstrap.min.js" />"></script>
<script src="<c:url value="/resources/bootstrap/bootstrap-validation.js" />"></script>
<script src="<c:url value="/resources/front/js/base.js"/>"></script>
<script type="text/javascript">
	$(document).ready(function(){
	
			
		$('#submitMe').click(function(){
			var username = $('input[name=username]').val();
			var password = $('input[name=password]').val();
			
			$.ajax({
				url:'<c:url value="/api/login" />',
				data:{'username':username,'password':password},
				dataType:'json',
				type:'post',
				success:function(data){
					console.log(data);
					if(data){
						if(data.code == '2100'){
							alert("请输入账号名称！");
							$('input[name=username]').focus();
						}else if(data.code == '2101'){
							alert('请输入密码！');
							$('input[name=password]').focus();
						}else if(data.code == '2102'){
							alert('用户名不正确，请重新输入');
							$('input[name=username]').focus();
						}else if(data.code == '2103'){
							alert('密码不正确，请重新输入');
							$('input[name=password]').focus();
						}else{
							window.location.reload();
						}
					}
				}
			})
		});
		
		
	})
	
	function logout(){
		$.ajax({
			url:'<c:url value="/api/logout" />',
			dataType:'json',
			type:'get',
			success:function(data){
				if(data && data.value && data.value == 'true'){
					window.location.reload();
				}
			}
		})
	}
	
</script>
